package org.webdb.webapp.injectors;

import javax.ws.rs.ext.Provider;

import org.jboss.resteasy.spi.StringConverter;
import org.webdb.core.Filter;
import org.webdb.core.filter.FilterFactory;

@Provider
public class FilterInjector implements StringConverter<Filter> {

    private FilterFactory factory;

    public FilterInjector(FilterFactory factory) {
        this.factory = factory;
    }

    @Override
    public Filter fromString(String str) {
        return factory.createFilter(str);
    }

    @Override
    public String toString(Filter value) {
        return value.toString();
    }

}
